/*
 * @Author: your name
 * @Date: 2020-12-01 16:13:51
 * @LastEditTime: 2020-12-14 11:59:50
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \zw_site\store\layout.js
 */

import { setDevice } from '~/plugins/cookie'
/** */
function getDefault() {
  return {
    device: 'desktop',
    title: ' ',
  }
}

export const state = () => getDefault()

export const mutations = {
  SET_DEVICE: (state, value) => {
    state.device = value
    setDevice(value)
  },
  SET_TITLE: (state, value) => {
    state.title = value
  },
}
export const getters = {
  device: (state) => state.device,
  title: (state) => state.title,
  isMobile: (state) => state.device === 'mobile',
}
